/*
 * Copyright:  2018 smarabbit studio.
 *
 *  Licensed under the Confluent Community License; you may not use this file
 *  except in compliance with the License.  You may obtain a copy of the License at
 *
 *  http://www.confluent.io/confluent-community-license
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OF ANY KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations under the License.
 *
 *  @作   者： 黄开晖 (117227773@qq.com)
 *  @日   期:  2021年8月25日
 */
package com.massyframework.beanskin.util.classloading;

import java.net.URL;
import java.util.Collection;
import java.util.Set;

import com.massyframework.beanskin.ModuleIdentifier;

/**
 * 模块类加载器构建器
 * @author huangkh
 *
 */
public interface ModuleClassLoaderBuilder {

	/**
	 * 添加本地资源路经
	 * @param value {@link LocalResourcesPath}
	 * @return {@link ModuleClassLoaderBuilder}
	 */
	ModuleClassLoaderBuilder addLocalResourcesPath(LocalResourcesPath value);
	
	/**
	 * 添加本地资源路经集合
	 * @param value {@link List}
	 * @return {@link ModuleClassLoaderBuilder}
	 */
	ModuleClassLoaderBuilder addLocalResourcesPaths(Collection<LocalResourcesPath> value);
	
	/**
	 * 添加jar资源的URL
	 * @param url {@link URL},jar资源url
	 * @return {@link ModuleClassLoaderBuilder}
	 */
	ModuleClassLoaderBuilder addURL(URL url);
	
	/**
	 * 添加jar资源Url集合
	 * @param urls {@link Collection}
	 * @return {@link ModuleClassLoaderBuilder}
	 */
	ModuleClassLoaderBuilder addURLs(Collection<URL> urls);
		
	/**
	 * 设置签名使用的证书名称和数据
	 * @param name {@link String},证书名称，用于区份不同的证书
	 * @param data {@link String}, 使用公钥对证书加密后的数据
	 * @return {@link ModuleClassLoaderBuilder}
	 */
	ModuleClassLoaderBuilder certificate(String name, String data);
	
	/**
	 * 设置需要解密的类名集合
	 * @param value {@link Set}, 类名
	 * @return {@link ModuleClassLoaderBuilder}
	 */
	ModuleClassLoaderBuilder decryptClassNames(Set<String> value);
	
	/**
	 * 设置需要解密的脚本文件
	 * @param value {@link Set}, 文件的路径集合
	 * @return {@link ModuleClassLoaderBuilder}
	 */
	ModuleClassLoaderBuilder decryptScriptFileNames(Set<String> value);
	
	/**
	 * 是否支持热部署
	 * @param value {@link boolean}
	 * @return {@link ModuleClassLoaderBuilder}
	 */
	ModuleClassLoaderBuilder hotDeployment(boolean value);
	
	/**
	 * 设备模块标识符
	 * @param value {@link ModuleIdentifier}
	 * @return {@link ModuleClassLoaderBuilder}
	 */
	ModuleClassLoaderBuilder moduleIdentifier(ModuleIdentifier value);
	
	/**
	 * 设置资源定位过滤器资源库
	 * @param value {@link ResoruceLocateFilterRepository}, 资源定位过滤器资源库
	 * @return {@link ModuleClassLoaderBuilder}
	 */
	ModuleClassLoaderBuilder resourceLocateFilterRepository(ResourceLocateFilterRepository value);
		
	/**
	 * 设置父加载器
	 * @param value {@link ClassLoader}
	 * @return {@link ModuleClassLoaderBuilder}
	 */
	ModuleClassLoaderBuilder parentClassLoader(ClassLoader value);
	
	/**
	 * 设置公钥
	 * @param value {@link String}
	 * @return {@link ModuleCLassLoaderBuilder}
	 */
	ModuleClassLoaderBuilder publicKey(String value);
		
	/**
	 * 构建器
	 * @return {@link ModuleClassLoader}
	 */
	ModuleClassLoader build();
}
